<!DOCTYPE HTML>
<html>
  <head>
    <!-- TODO(misha): Move this code to .js file so it'll be a proper module -->
    <embed type='application/x-browntooth-npapi' id='browntooth-npapi-plugin-id' hidden='true'/>
    <script>
      var browntooth = {
        'processRequest': function(request) {
          var pluginElement = document.getElementById('browntooth-npapi-plugin-id');
          if (!pluginElement) {
            console.log('Error: Cannot find the embed tag');
            return null;
          }
          var browntoothClass = pluginElement.BrownToothNPAPI();
          return browntoothClass.processRequest(request);
        }
      }
    </script>

    <script>
      function init() {
        document.getElementById('output').innerHTML = browntooth.processRequest('from chrome');
      }
    </script>
  </head>
<body onload='init()'>
<div id='output'></div>
</body>
</html>
